<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>文章管理</title>
    <script type="text/javascript" src="./../../../static/js/include/_include-css.js"></script>
    <link href="./../../../static/plugins/jquery-ztree/3.5/css/metro/zTreeStyle.css" rel="stylesheet" />

</head>

<body class="bg-gray">
    <div class="ui-layout-west bg-white">
        <div class="panel panel-noborder">
            <div class="panel-heading"><b><i class="fa fa-fw fa-bars"></i>栏目管理</b>
                <div class="tools pull-right">
                    <a href="#"><i class="fa fa-chevron-down " onclick="$.tree.expand();"></i></a>
                    <a href="#"><i class="fa fa-chevron-up " onclick="$.tree.collapse();"></i></a>

                    <a href="#"><i class="fa fa-refresh"></i></a>
                </div>
            </div>
            <div class="panel-body-sm">
                <div id="ztree1" class="ztree"></div>
            </div>
        </div>
    </div>
    <div class="ui-layout-center">
        <div class="wrapper-container">
            <div class="row">
                <div class="col-md-12 ">
                    <div class="search-panel">
                        <form id="search-form">
                            <div class="select-list">
                                <ul>
                                    <li>
                                        文章标题：<input type="text"  />
                                    </li>
                                    <li>
                                        发布时间：<input type="text" class="time-input " readonly />
                                    </li>
                                    <li>
                                        发布状态：<select name="status" class="select2">
                                            <option value="">请选择状态</option>
                                            <option value="0">已发布</option>
                                            <option value="1">未发布</option>
                                        </select>
                                    </li>
                                    <li>
                                        <a class="btn btn-primary btn-round btn-sm btn-search-submit"
                                            onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                        <a class="btn btn-warning btn-round btn-sm btn-search-reset"
                                            onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-primary btn-list-top-add" onclick="$.operate.addTab()">
                        <i class="fa fa-plus"></i> 新增文章
                    </a>
                </div>
                <div class="col-md-12 select-table">
                    <div class="panel">
                        <div class="panel-body-sm">
                            <table id="bootstrap-table"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script type="text/javascript" src="./../../../static/js/include/_include-js.js"></script>
    <script type="text/javascript" src="./../../../static/plugins/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"></script>

    <script>
        $(function () {
            $('body').layout({
                initClosed: false,
                west__size: 250
            });

            $.tree.init(
                {
                    id: 'ztree1',
                    url: './../../../static/data/article-tree.json',
                    expandLevel: -1,
                    check: {
                        enable: false
                    },
                }
            );
            var options = {
                url: "./../../../static/data/article_list.json",
                method: 'get',
                modalName: '文章信息',
                createUrl: "./../../../pages/examples/pages/article_add.html",
                showSearch: true,
                showRefresh: true,
                showToggle: false,
                showColumns: false,
                clickToSelect: false,
                sidePagination: 'client',
                columns: [{
                    checkbox: true
                },
                {
                    title: '序号',
                    width: 5,
                    align: "center",
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'title',
                    title: '文章标题'
                },
                {
                    field: 'thumbnail',
                    title: '缩略图',
                    formatter:function(value,row,index){
                        return $.table.imageView(value,200,300);
                    }
                },
                {
                    field: 'channel',
                    title: '所属栏目',
                    formatter: function (value, row, index) {
                            return '<label class="label label-primary">'+ value +'</label>';
                    }
                },
                {
                    field: 'viewNum',
                    title: '浏览量'
                },
                
                {
                    field: 'sort',
                    title: '排序'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return '<label class="badge badge-primary">已发布</label>';
                        } else {
                            return '<label class="badge badge-danger">未发布</label>';
                        }
                    }
                },
                {
                    field: 'sendTime',
                    title: '发布时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs" href="#" onclick="userEditor()"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>

</html>